package com.zyj.guava.stopwatch;

import com.google.common.base.Stopwatch;

import java.util.concurrent.TimeUnit;

public class MethodTimeConsuming2 {

    public static void main(String[] args) throws InterruptedException {
        var stopwatch = Stopwatch.createStarted();
        consumeTime();
        var consumeTime = stopwatch.elapsed();
        System.out.println("consume time = " + consumeTime);
    }

    public static void consumeTime() throws InterruptedException {
        TimeUnit.SECONDS.sleep(2);
    }

}